package com.bitejiuyeke.job_publish.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum VerifyCodeTypeEnum {
    REGISTER (0, "注册"),
    LOGIN (1, "登录"),
    FIND_PWD (2, "找回密码");

    /**
     * 状码态
     * */
    private int code;
    /**
     * 描述
     * */
    private String message;


    public String toString () {
        return "code = " + code + ", message = " + message + ". ";
    }

    /**
     * 根据状态码获取枚举对象
     * @param code 状态码
     * @return VerifyCodeStateTypeEnum对象
     */
    public static VerifyCodeTypeEnum valueOf(int code) {
        for (VerifyCodeTypeEnum enums : VerifyCodeTypeEnum.values()) {
            if (code == enums.getCode()) {
                return enums;
            }
        }
        return null;
    }
}
